<?php echo $header; ?>
<div id="content">
    <div class="breadcrumb">
        <?php foreach ($breadcrumbs as $breadcrumb) { ?>
        <?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
        <?php } ?>
    </div>
    <?php if ($error_warning) { ?>
    <div class="warning"><?php echo $error_warning; ?></div>
    <?php } ?>
    <?php if ($success) { ?>
    <div class="success"><?php echo $success; ?></div>
    <?php } ?>
    <div class="box">
        <div class="heading">
            <h1><img src="view/image/category.png" alt="" /> <?php echo $heading_title; ?></h1>
            <div class="buttons"><a onclick="location = '<?php echo $insert; ?>'" class="button"><?php echo $button_insert; ?></a><a onclick="$('#form').submit();" class="button"><?php echo $button_delete; ?></a></div>
        </div>
        <div class="content">
            <form action="<?php echo $delete; ?>" method="post" enctype="multipart/form-data" id="form">
                <table class="list">
                    <thead>
                    <tr>
                        <td width="1" style="text-align: center;"><input type="checkbox" onclick="$('input[name*=\'selected\']').attr('checked', this.checked);" /></td>
                        <td class="left"><?php echo $column_name; ?></td>
                        <td class="right"><?php echo $column_sort_order; ?></td>
                        <td class="right"><?php echo $column_action; ?></td>
                    </tr>
                    </thead>
                    <tbody>
                    <?php if ($forum_categories) { ?>
                        <?php foreach ($forum_categories as $forum_category) { ?>
                        <tr>
                            <td style="text-align: center;"><?php if ($forum_category['selected']) { ?>
                                <input type="checkbox" name="selected[]" value="<?php echo $forum_category['forum_id']; ?>" checked="checked" />
                                <?php } else { ?>
                                <input type="checkbox" name="selected[]" value="<?php echo $forum_category['forum_id']; ?>" />
                                <?php } ?></td>
                            <td class="left"><?php echo $forum_category['forum_name']; ?></td>
                            <td class="right"><?php echo $forum_category['sort_order_id']; ?></td>
                            <td class="right"><?php foreach ($forum_category['action'] as $action) { ?>
                                [ <a href="<?php echo $action['href']; ?>"><?php echo $action['text']; ?></a> ]
                                <?php } ?></td>
                        </tr>
                        <?php if (isset($forums[$forum_category['forum_id']]) && $forums[$forum_category['forum_id']]) { ?>
                            <?php foreach ($forums[$forum_category['forum_id']] as $forum) { ?>
                            <tr>
                                <td style="text-align: center;"><?php if ($forum['selected']) { ?>
                                    <input type="checkbox" name="selected[]" value="<?php echo $forum['forum_id']; ?>" checked="checked" />
                                    <?php } else { ?>
                                    <input type="checkbox" name="selected[]" value="<?php echo $forum['forum_id']; ?>" />
                                    <?php } ?></td>
                                <td class="left"><?php echo $forum['forum_name']; ?></td>
                                <td class="right"><?php echo $forum['sort_order_id']; ?></td>
                                <td class="right"><?php foreach ($forum['action'] as $action) { ?>
                                    [ <a href="<?php echo $action['href']; ?>"><?php echo $action['text']; ?></a> ]
                                    <?php } ?></td>
                            </tr>
                                <?php if (isset($sub_forums[$forum['forum_id']]) && $sub_forums[$forum['forum_id']]) { ?>
                                    <?php foreach ($sub_forums[$forum['forum_id']] as $sub_forum) { ?>
                                    <tr>
                                        <td style="text-align: center;"><?php if ($sub_forum['selected']) { ?>
                                            <input type="checkbox" name="selected[]" value="<?php echo $sub_forum['forum_id']; ?>" checked="checked" />
                                            <?php } else { ?>
                                            <input type="checkbox" name="selected[]" value="<?php echo $sub_forum['forum_id']; ?>" />
                                            <?php } ?></td>
                                        <td class="left"><?php echo $sub_forum['forum_name']; ?></td>
                                        <td class="right"><?php echo $sub_forum['sort_order_id']; ?></td>
                                        <td class="right"><?php foreach ($sub_forum['action'] as $action) { ?>
                                            [ <a href="<?php echo $action['href']; ?>"><?php echo $action['text']; ?></a> ]
                                            <?php } ?></td>
                                    </tr>
                                        <?php } ?>
                                    <?php } ?>
                                <?php } ?>
                            <?php } ?>
                        <?php } ?>
                    <?php } else { ?>
                    <tr>
                        <td class="center" colspan="4"><?php echo $text_no_results; ?></td>
                    </tr>
                    <?php } ?>
                    </tbody>
                </table>
            </form>
        </div>
    </div>
</div>
<?php echo $footer; ?>